<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>喜乐康智能家居系统</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="<%=basePath%>js/jquery-ui-1.8.10.custom.min.js"></script>
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/ui-lightness/jquery-ui-1.8.10.custom.css">
  	<script type="text/javascript">
  		function deviceModelList(upDown){
			if(upDown=='down'){
				$(".device_setting_list_button").css("background-image", "url('" + evn_Path+ "resource/setting_device_space_button_press.png')");
			}else if(upDown=='up'){
				listSpace = 1;
				$(".setting_background").load(evn_Path+"setting!device.do?deviceModel=1&roomId=<s:property value="roomId" />");
			}
	  	}

	  	$(function(){
			$(".setting_device_space_b_1").attr("className","setting_device_space_b_<s:property value="room.roomImage" />");
		  })
  		
  	</script>
  	
  </head>
  
  <body>
  	<div style="width: 100%;height: 17px;"></div>
  	<div class="setting_device_space_b">
  		<div style="height: 66px;"></div>
  		<div class="setting_device_space_b_1">
  			<s:iterator value="deviceList" id="device">
  				<div 
  				<s:if test="deviceType==1 && isOpen == 1">
		   					class="device_use_img_li_on_off_open_s"
   				</s:if>	
   				<s:elseif test="deviceType==1 && isOpen == 0">
					class="device_use_img_li_on_off_s"
				</s:elseif>
				<s:elseif test="deviceType==2 && isOpen == 1">
					class="device_use_img_li_turn_open_s"
				</s:elseif>
				<s:elseif test="deviceType==2 && isOpen == 0">
					class="device_use_img_li_turn_s"
				</s:elseif>
   				<s:elseif test="deviceType==3 && isOpen == 1">
					class="device_use_img_li_socket_open_s"
				</s:elseif>	
				<s:elseif test="deviceType==3 && isOpen == 0">
					class="device_use_img_li_socket_s"
				</s:elseif>	
  				style="left: <s:property value="deviceX" />px; top: <s:property value="deviceY" />px;" id="device_use_img_li_s<s:property value="deviceId" />">
					<s:property value="deviceName" />
				</div>
  				<script type="text/javascript">
  				$("#device_use_img_li_s<s:property value="deviceId" />").draggable({stop: function(event, ui){
  	  				var left = ui.position.left;
  	  				var top = ui.position.top;
  	  				
  					$.post(evn_Path + "setting!saveDevice.do", {
  						'deviceId' : "<s:property value="deviceId" />",
  						'deviceX' : ui.position.left,
  						'deviceY' : ui.position.top
  					}, function(data) {
  						
  					}

  					);
	  				},containment: 'parent' 
	  			});	
			  	</script>
  			</s:iterator>
  			
  		</div>
  		<div class="device_setting_list_button" onmousedown="deviceModelList('down')" onmouseup="deviceModelList('up')">列表模式</div>
  	</div>
  </body>
</html>
